home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume13 / vn.jan.88 / part04 < prev    next >
Encoding:
Internet Message Format  |  1988-01-30  |  38.0 KB

  1. Subject:  v13i022:  VN newsreader, 1/88 version, Part04/05
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: Bob Mcqueer <amdahl!rtech!rtech!bobm@UUNET.UU.NET>
  7. Posting-number: Volume 13, Issue 22
  8. Archive-name: vn.jan.88/part04
  9.  
  10. #! /bin/sh
  11. # This is a shell archive, meaning:
  12. # 1. Remove everything above the #! /bin/sh line.
  13. # 2. Save the resulting text in a file.
  14. # 3. Execute the file with /bin/sh (not csh) to create the files:
  15. #    vn.c
  16. #    help.c
  17. #    pagefile.c
  18. #    digest.c
  19. #    brk.h
  20. #    head.h
  21. #    node.h
  22. #    page.h
  23. #    reader.h
  24. #    server.h
  25. #    tty.h
  26. #    tune.h
  27. #    vn.h
  28. export PATH; PATH=/bin:$PATH
  29. echo shar: extracting "'vn.c'" '(8371 characters)'
  30. if test -f 'vn.c'
  31. then
  32.     echo shar: will not over-write existing file "'vn.c'"
  33. else
  34. cat << \SHAR_EOF > 'vn.c'
  35. /*
  36. vn news reader for visual page oriented display of news
  37. aimed at scanning large numbers of articles.
  38.  
  39. Original program by Bob McQueer in several versions 1983-1986.  Released
  40. into the public domain in 1986.  While no copyright notice appears, the
  41. original author asks that a history of changes crediting the proper people
  42. be maintained.
  43.  
  44. Bob McQueer
  45. {amdahl, sun, mtxinu, hoptoad, cpsc6a}!rtech!bobm
  46.  
  47. History:
  48.  
  49.     (bobm@rtech) 5/86 - first "public" version
  50.  
  51.     (bobm@rtech) 12/86 - version incorporates:
  52.  
  53.         bug fixes:
  54.             str_store NULL string bug
  55.             not picking up first article in newsgroup
  56.             RESTART terminal reset for exit to editor.
  57.             skip whitespace in "empty" digest lines while unpacking
  58.             DISTRIBUTION line in followups.
  59.             :100%: prompt on last line in reader.
  60.             interpretation of multiple negations -w -t options.
  61.  
  62.             Many thanks to several people who noted the first
  63.             two bugs as well as fixes.
  64.  
  65.             Thank you to Karl Williamson for helpful information
  66.             tracking down the "concept terminal" bug (RESTART).
  67.  
  68.         SYSV ifdef's adapted from those done by Larry Tepper
  69.         at ATT Denver - sent in by Karl Williamson, drutx!khw.
  70.         Many people submitted SYSV ifdef's - thank you all.
  71.  
  72.         print capability from reader from Karl Williamson,
  73.         drutx!khw
  74.  
  75.         Changes to use alternate header lines for mail, from changes
  76.         by Andy Marrinson, andy@icom.UUCP (ihnp4!icom!andy).  Ifdef'ed
  77.         to allow local configuration (bobm@rtech).
  78.  
  79.         "author_copy" file for followups, prevention of multiple
  80.         "re: "'s, insert blank line and original author line
  81.         before excerpted text from Andy Marrinson, andy@icom.UUCP
  82.  
  83.         Search string capability in reader, from Lawrie Brown,
  84.         seismo!munnari!cdsadfa.oz!lpb (Australia).  Somewhat
  85.         modified by interaction with the :100%: bug.
  86.  
  87.         Arrow key support, adapted from changes by Lawrie Brown.
  88.         Modified to simply not allow control keys for arrows (allowing
  89.         SOME controls is too prone to problems, esp. with .vnkey), and
  90.         to allow the PAGEARROW ifdef (bobm@rtech)
  91.  
  92.         prevention of followups to "mod" and "announce", from
  93.         Lawrie Brown.
  94.  
  95.         OLDRC ifdef adapted from changes by Lawrie Brown.  ADDRMUNGE
  96.         added to allow OZ domain addressing changes from Australia
  97.         to be grafted back in, and provide a hook for anybody else
  98.         wanting to do something similar.
  99.  
  100.         Bob McQueer, bobm@rtech:
  101.  
  102.             a menu selection from the % command to jump to
  103.             a new newsgroup
  104.  
  105.             linked list on hash table - no longer a compiled
  106.             in limit for number of newsgroups
  107.  
  108.             .vnkey keystroke mapping file.
  109.  
  110.             options to get the % command list on entry, and to
  111.             change how unsubscribed groups are handled for updates.
  112.  
  113.             allow configurable use of vs / ve pair for terminal
  114.             handling.
  115.  
  116.     8/87 (bobm@rtech)
  117.  
  118.         Server interface changes.  Creation of vns_xxx routines
  119.         formally defining how to attach vn to an abstracted
  120.         news server, rearranged existing code to use that
  121.         abstraction.  Sourcefile list altered a good bit by
  122.         the rearrangement.  Some of this was splitting some
  123.         routines out from vn.c into smaller modules.  Reader
  124.         code was altered a good bit to work through the
  125.         ARTHEADER abstraction, rather than searching for
  126.         header lines.  Temp file writing code was the other
  127.         area heavily affected.  The std.c server interface
  128.         essentially incorporates the old newsrc.c code, plus
  129.         the old outgroup() and gethead() routines.
  130.  
  131.         vns_changes also included:
  132.  
  133.             Modification of mailer interface for MAILCHOOSE,
  134.             getting rid of ADDRMUNGE (superseded by vns
  135.             interface definition)
  136.  
  137.             Moved readstr() into the session loop code,
  138.             allowing a lot of static declarations to be
  139.             placed therein.  Also made it possible to
  140.             use strtok() underneath readstr().
  141.  
  142.             Made "save" write directly into file, rather
  143.             than forking a cat (gee, that sounds perverse).
  144.  
  145.             Also fixes it so that "|" save convention works
  146.             from reader.
  147.  
  148.             Digest unpacking has to know about header lines,
  149.             unfortunately, so it has local definitions for
  150.             some header lines.
  151.  
  152.         Incorporates:
  153.  
  154.             The much-discussed "continued header line" bug
  155.             fix, of course.  Includes the multiple header
  156.             line nfgets() by Andrew Worsley, andrew@munnari.oz,
  157.             with a couple cosmetic changes.
  158.  
  159.             Top / Middle / Bottom keys from Karl Williamson
  160.             print capability from reader from Karl Williamson,
  161.             drutx!khw
  162.  
  163.             Edit old save file changes from George Pavel,
  164.             gp@lll-lcc.arpa.  Used it to allow edit of
  165.             the some other old strings, too.
  166.  
  167.             Fix for the bad number input bug on the choose
  168.             new group from list feature, as reported by
  169.             Dave Tallman, tallman@hc.arpa.  His fix with
  170.             a few minor changes.
  171.  
  172.             A couple save file tweaks - allow a "%s" in VNSAVE
  173.             to specify individual directories by newsgroup.
  174.             Allow a "w:" prefix on filename to write instead
  175.             of appending, allow %d for article number in name.
  176.  
  177.             The VNEDITOR variable.
  178.  
  179.             Statistics collection ability.
  180.  
  181.             Update of .newsrc "read" number to reflect removed
  182.             articles, preventing rescanning of group on next
  183.             session.
  184.  
  185.             take out SIGHUP catching to avoid problems with
  186.             message being output.
  187.  
  188.             key to print version being used.
  189.  
  190.     Bug fixes following 12/87 posting.  Made this version 1/88 / res1.1
  191.     to distinguish.
  192.  
  193.         Digest extraction in reader.c, fix from steve@mahendo.  Thanks
  194.         to steve@mahendo & greg@mahendo for tracking down digest
  195.         extraction bugs.  I obviously didn't beat on the feature enough
  196.         after rearranging things to abstract the server interface.
  197.         The digest extraction display is a little less informative,
  198.         the price paid to allow mail & followup.
  199.  
  200.         SYS V ifdefs - svart.c, independently arrived at by several
  201.         people - thank you.  At the behest of a couple people I made
  202.         it spawn a "mkdir" instead of punting by calling mknod.
  203.  
  204.         Fix bug which would cause vn to crash if article has
  205.         no "From" / "Reply-to" / "Path" line. - std.c
  206.  
  207.         Fix bug preventing assignment of .newsrc to filesystem other
  208.         than that containing user's HOME.
  209.  
  210.         Fix excessive allocation in hash.c
  211.  
  212.         Handle duplicate active list records more gracefully.
  213.  
  214.         term_set(RESTART) call added to recovery from being
  215.         backgrounded in sig_set.c, in case something you ran while
  216.         backgrounded messed up your terminal state.  I lost the name
  217.         of the person reporting the problem & fix - my apologies.
  218.  
  219.         display optimization in reader.c which repaints instead of
  220.         scrolling if indicated by user's MORE variable.  This came
  221.         from Greg Earle, earle@mahendo.  Modified slightly for
  222.         cosmetic reasons & to fix a small folded-line bug.
  223.  
  224. Known bugs:
  225.  
  226.     If your terminal init string contains a newline, I suspect you will
  227.     get an initial "stopped on tty output" if you fire up backgrounded.
  228.     Cooked mode until session is started probably saves us in a lot of
  229.     cases where the init string contains no newlines.  Can be fixed, but
  230.     it's esoteric enough that I don't want to add another file to the
  231.     "patched" list.
  232.  
  233.     non-erasure of stuff on prompt line when the new
  234.     string includes an escape sequence (like PS1 maybe)
  235.     because it doesn't realize that the escape sequence
  236.     won't overprint the existing stuff
  237.  
  238.     control-w and update on exit may not update pages which have been
  239.     scanned in funny orders by jumping into the middle of groups
  240.  
  241.     inaccurate numbers on '%' command results - reflect ranges, not
  242.     actual numbers of articles.
  243.  
  244.     no arrow keys recognized which don't begin with <escape>
  245.  
  246.     doesn't know about the version 2.11 'm' in active list, or
  247.     use the 'y' / 'n' either.
  248.  
  249.     crash due to embedding $\(\) type substring specifiers in regular
  250.     expressions.  Obscure and hard to fix in a proper and portable way.
  251. */
  252. #include <stdio.h>
  253. #include "node.h"
  254. #include "tty.h"
  255. #include "brk.h"
  256.  
  257. extern int Lrec;
  258.  
  259. extern NODE **Newsorder;
  260. extern int Ncount;
  261.  
  262. extern int Listfirst, Nounsub;
  263.  
  264. main(argc,argv)
  265. int argc;
  266. char **argv;
  267. {
  268.     /*
  269.         initialize environment variables,
  270.         scan .newsrc file, using any command line options present.
  271.      */
  272.     term_set (START);
  273.     envir_set ();
  274.     sig_set (BRK_IN);
  275.  
  276.     stat_start();
  277.  
  278.     hashinit();
  279.     temp_open();
  280.  
  281.     vns_news (argc,argv,&Listfirst,&Nounsub);
  282.  
  283.     fw_done ();
  284.  
  285.     make_newsorder();
  286.  
  287.     tty_set (BACKSTOP);
  288.  
  289.     if (Lrec >= 0)
  290.         session ();
  291.     else
  292.     {
  293.         new_groups ();
  294.         fprintf (stderr,"\nNo News\n");
  295.     }
  296.  
  297.     tty_set (COOKED);
  298.  
  299.     /* exiting, don't worry about FLG_ECHG resetting */
  300.     vns_write(Newsorder,Ncount);
  301.  
  302.     term_set (STOP);
  303.     vns_exit(0);
  304.  
  305.     stat_end( Lrec >= 0 ? 1 : 0 );
  306. }
  307. SHAR_EOF
  308. fi # end of overwriting check
  309. echo shar: extracting "'help.c'" '(5499 characters)'
  310. if test -f 'help.c'
  311. then
  312.     echo shar: will not over-write existing file "'help.c'"
  313. else
  314. cat << \SHAR_EOF > 'help.c'
  315. /*
  316. ** vn news reader.
  317. **
  318. ** help.c - print help
  319. **
  320. ** see copyright disclaimer / history in vn.c source file
  321. */
  322. #include <stdio.h>
  323. #include <setjmp.h>
  324. #include "config.h"
  325. #include "tty.h"
  326. #include "tune.h"
  327. #include "node.h"
  328. #include "page.h"
  329. #include "reader.h"
  330. #include "vn.h"
  331.  
  332. extern int L_allow;
  333. extern int C_allow;
  334. extern int Digest;
  335. extern char *Contstr;
  336. extern char Cxptoi[], Cxrtoi[];
  337.  
  338. /*
  339.     Help message table.  Character for command, plus its help
  340.     message.  Table order is order of presentation to user.
  341. */
  342. static struct HELPTAB
  343. {
  344.     char cmd, *msg;
  345.     int dig;
  346.     char *amsg;
  347. Helptab [] =
  348. {
  349.     { QUIT, "quit", 1, NULL},
  350.     { UP, "(or up arrow) move up [number of lines]", 1, NULL},
  351.     { DOWN, "(or down arrow) move down [number of lines]", 1, NULL},
  352. #ifdef PAGEARROW
  353.     { BACK, "(or left arrow) previous page [number of pages]", 1, NULL},
  354.     { FORWARD, "(or right arrow) next page [number of pages]", 1, NULL},
  355. #else
  356.     { BACK, "previous page [number of pages]", 1, NULL},
  357.     { FORWARD, "next page [number of pages]", 1, NULL},
  358. #endif
  359.     { TOPMOVE, "move to top of page", 1, NULL},
  360.     { BOTMOVE, "move to bottom of page", 1, NULL},
  361.     { ALTBOTTOM, "move to bottom of page (alternate L)", 1, NULL},
  362.     { MIDMOVE, "move to middle of page", 1, NULL},
  363.     { DIGEST, "unpack digest", 1, "exit digest"},
  364.     { READ, "read article [number of articles]", 1, NULL},
  365.     { ALTREAD, "read article (alternate 'r')", 1, NULL},
  366.     { READALL, "read all articles on page", 1, NULL},
  367.     { READSTRING, "specify articles to read", 1, NULL},
  368.     { SAVE, "save or pipe article [number of articles]", 1, NULL},
  369.     { SAVEALL, "save or pipe all articles on page", 1, NULL},
  370.     { SAVESTRING, "specify articles to save", 1, NULL},
  371.     { ALTSAVE, "specify articles to save (alternate ctl-s)", 1, NULL},
  372.     { PRINT, "print article [number of articles]", 1, NULL},
  373.     { PRINTALL, "print all article on page", 1, NULL},
  374.     { PRINTSTRING, "specify articles to print", 1, NULL},
  375.     { UPDATE, "update .newsrc status to cursor", 0, NULL},
  376.     { UPALL, "update .newsrc status for whole newsgroup", 0, NULL},
  377.     { UPSEEN, "update .newsrc status for all pages displayed", 0, NULL},
  378.     { ORGGRP, "recover original .newsrc status for newsgroup", 0, NULL},
  379.     { ORGSTAT, "recover all original .newsrc status", 0, NULL},
  380.     { SSTAT, "display count of groups and pages - shown and total", 0, NULL},
  381.     { GRPLIST, "list newsgroups with new article, updated counts", 0, NULL},
  382.     { NEWGROUP, "specify newsgroup to display and/or resubscribe to", 1, NULL},
  383.     { UNSUBSCRIBE, "unsubscribe from group", 0, NULL},
  384.     { MARK, "mark/unmark article [number of articles]", 1, NULL},
  385.     { ART_MARK, "mark/unmark article [number of articles]", 1, NULL},
  386.     { UNMARK, "erase marks on articles", 1, NULL},
  387.     { HEADTOG, "toggle flag for display of headers when reading", 1, NULL},
  388.     { SETROT, "toggle rotation for reading", 1, NULL},
  389.     { REDRAW, "redraw screen", 1, NULL},
  390.     { UNESC, "escape to UNIX to execute a command", 1, NULL},
  391.     { PRTVERSION, "show vn version", 1, NULL},
  392.     { HELP, "show this help menu", 1, NULL}
  393. };
  394.  
  395. #define HTSIZE (sizeof(Helptab)/sizeof(struct HELPTAB))
  396.  
  397. /*
  398.     help from main screen
  399. */
  400. help ()
  401. {
  402.     int i,lcount,lim; 
  403.     term_set (ERASE);
  404.     lim = L_allow + RECBIAS - 2;
  405.     printf("%s\n",HELP_HEAD);
  406.     lcount = HHLINES;
  407.     for (i=0; i < (sizeof(Helptab))/(sizeof(struct HELPTAB)); ++i)
  408.     {
  409.         if (Digest && !(Helptab[i].dig))
  410.             continue;
  411.         ++lcount;
  412.         if (Digest && Helptab[i].amsg != NULL)
  413.             h_print (Cxptoi[Helptab[i].cmd],Helptab[i].amsg);
  414.         else
  415.             h_print (Cxptoi[Helptab[i].cmd],Helptab[i].msg);
  416.         if (lcount >= lim)
  417.         {
  418.             printf ("\n%s",Contstr);
  419.             getnoctl ();
  420.             term_set (MOVE,0,lim+1);
  421.             term_set (ZAP,0,strlen(Contstr));
  422.             term_set (MOVE,0,lim-1);
  423.             putchar ('\n');
  424.             lcount = 0;
  425.         }
  426.     }
  427.     if (lcount > 0)
  428.     {
  429.         printf ("\n%s",Contstr);
  430.         getnoctl ();
  431.     }
  432. }
  433.  
  434. /*
  435.     help from reader
  436. */
  437. help_rd()
  438. {
  439.     h_print (Cxrtoi[PG_NEXT],HPG_NEXT);
  440.     h_print (Cxrtoi[PG_QUIT],HPG_QUIT);
  441.     h_print (Cxrtoi[PG_FLIP],HPG_FLIP);
  442.     h_print (Cxrtoi[PG_REWIND],HPG_REWIND);
  443.     h_print (Cxrtoi[PG_WIND],HPG_WIND);
  444.     h_print (Cxrtoi[PG_SEARCH],HPG_SEARCH);
  445.     h_print (Cxrtoi[PG_STEP],HPG_STEP);
  446.     h_print (Cxrtoi[PG_REPLY],HPG_REPLY);
  447.     h_print (Cxrtoi[PG_FOLLOW],HPG_FOLLOW);
  448.     h_print (Cxrtoi[SAVE],HPG_SAVE);
  449.     h_print (Cxrtoi[PRINT],HPG_PRINT);
  450.     h_print (Cxrtoi[SETROT],HPG_ROT);
  451.     h_print (Cxrtoi[HEADTOG],HPG_HEAD);
  452.     h_print (Cxrtoi[PG_HELP],HPG_HELP);
  453.     printf ("%s\n",HPG_DEF);
  454. }
  455.  
  456. srch_help(c,dig)
  457. char c;
  458. int *dig;
  459. {
  460.     int i;
  461.  
  462.     for (i=0; i < HTSIZE; ++i)
  463.         if (Helptab[i].cmd == c)
  464.             break;
  465.     if (i < HTSIZE)
  466.     {
  467.         *dig = Helptab[i].dig;
  468.         return (0);
  469.     }
  470.     return(-1);
  471. }
  472.  
  473. /*
  474.     h_print prints a character and a legend for a help menu.
  475. */
  476. static
  477. h_print(c,s)
  478. char c,*s;
  479. {
  480.     if (strlen(s) > (C_allow - 14))
  481.         s [C_allow - 14] = '\0';
  482.     if (c > ' ' && c != '\177')
  483.         printf ("     %c - %s\n",c,s);
  484.     else
  485.     {
  486.         switch (c)
  487.         {
  488.         case '\177':
  489.             printf ("  <delete> - %s\n",s);  
  490.             break;
  491.         case '\040':
  492.             printf ("   <space> - %s\n",s);  
  493.             break;
  494.         case '\033':
  495.             printf ("  <escape> - %s\n",s);  
  496.             break;
  497.         case '\n':
  498.             printf ("  <return> - %s\n",s);  
  499.             break;
  500.         case '\t':
  501.             printf ("     <tab> - %s\n",s);  
  502.             break;
  503.         case '\b':
  504.             printf (" <back sp> - %s\n",s);  
  505.             break;
  506.         case '\f':
  507.             printf ("<formfeed> - %s\n",s);  
  508.             break;
  509.         case '\07':
  510.             printf ("    <bell> - %s\n",s);  
  511.             break;
  512.         case '\0':
  513.             printf ("    <null> - %s\n",s);  
  514.             break;
  515.         default:
  516.             if (c < '\033')
  517.             {
  518.                 c += 'a' - 1;
  519.                 printf(" control-%c - %s\n",c,s);
  520.             }
  521.             else
  522.                 printf("       %c0%o - %s\n",'\\',(int) c,s);
  523.             break;
  524.         }
  525.     }
  526. }
  527. SHAR_EOF
  528. fi # end of overwriting check
  529. echo shar: extracting "'pagefile.c'" '(4093 characters)'
  530. if test -f 'pagefile.c'
  531. then
  532.     echo shar: will not over-write existing file "'pagefile.c'"
  533. else
  534. cat << \SHAR_EOF > 'pagefile.c'
  535. /*
  536. ** vn news reader.
  537. **
  538. ** pagefile.c - routines to deal with page display tempfile
  539. **
  540. ** see copyright disclaimer / history in vn.c source file
  541. */
  542.  
  543. #include <stdio.h>
  544.  
  545. #ifdef SYSV
  546. #include <sys/types.h>
  547. #include <fcntl.h>
  548. #endif
  549.  
  550. #include <sys/file.h>
  551.  
  552. #include "tune.h"
  553. #include "node.h"
  554. #include "page.h"
  555.  
  556. extern int Ncount,Lrec,L_allow,Cur_page,C_allow;
  557. extern NODE **Newsorder;
  558. extern PAGE Page;
  559. extern int Digest;
  560.  
  561. extern char *Aformat;
  562.  
  563. extern char *T_head, *F_head, *L_head;
  564.  
  565. static int Tdes;    /* temp file descriptor */
  566. static int Pgsize;    /* block size for seeking file */
  567.  
  568. static NODE *Curgp = NULL;    /* current newsgroup being written */
  569. static int Order = 0;        /* order counter */
  570.  
  571. /*
  572.     routines which deal with the temp file containing
  573.     display pages.  Note the "invisible" file feature -
  574.     tempfile is unlinked from /usr/tmp immediately.  when
  575.     Tdes is closed by UNIX the disk space will be given back.
  576. */
  577.  
  578. temp_open ()
  579. {
  580.     char tmpart [L_tmpnam];
  581.     Lrec = -1;
  582.     tmpnam (tmpart);
  583.     Pgsize = sizeof (HEAD) + L_allow * sizeof(BODY);
  584.     if ((Tdes = open(tmpart,O_RDWR|O_CREAT)) < 0)
  585.         printex ("can't open %s",tmpart);
  586.     unlink (tmpart);
  587. }
  588.  
  589. /*
  590. ** set newsgroup for tempfile write
  591. */
  592. fw_group(ng,new,sub,rd,look)
  593. char *ng;
  594. int new;
  595. int sub;
  596. int rd;
  597. int look;
  598. {
  599.     NODE *hashfind();
  600.  
  601.     if (Curgp != NULL && Page.h.artnum > 0)
  602.         fw_flush();
  603.     
  604.     if ((Curgp = hashfind(ng)) == NULL)
  605.         printex("fw_group - non-existent newsgroup, \"%s\"",ng);
  606.     if (Curgp->order >= 0)
  607.         printex("fw_group - repeat call on newsgroup, \"%s\"",ng);
  608.     Curgp->order = Order;
  609.     ++Order;
  610.     fw_chg(new,sub,rd,look);
  611.     Curgp->pages = 0;
  612.     Curgp->pnum = Lrec+1;
  613.     Page.h.name = Curgp->nd_name;
  614.     Page.h.group = Curgp;
  615.     Page.h.artnum = 0;
  616. }
  617.  
  618. fw_chg(new,sub,rd,look)
  619. int new;
  620. int sub;
  621. int rd;
  622. int look;
  623. {
  624.     Curgp->flags &= ~(FLG_NEW|FLG_SUB|FLG_SEARCH);
  625.     if (new)
  626.         Curgp->flags |= FLG_NEW;
  627.     if (sub)
  628.         Curgp->flags |= FLG_SUB;
  629.     if (look)
  630.         Curgp->flags |= FLG_SEARCH;
  631.     Curgp->rdnum = Curgp->orgrd = Curgp->pgrd = rd;
  632. }
  633.  
  634. /*
  635. ** write article to temp file.
  636. */
  637. fw_art(anum,subj,lines,author)
  638. int anum;
  639. char *subj;
  640. char *lines;
  641. char *author;
  642. {
  643.     char tbuf[RECLEN];
  644.     int idx;
  645.  
  646.     form_title(tbuf,subj,lines,author,anum);
  647.     idx = Page.h.artnum;
  648.     strcpy((Page.b)[idx].art_t, tbuf);
  649.     (Page.b)[idx].art_id = anum;
  650.     (Page.b)[idx].art_mark = ' ';
  651.  
  652.     ++(Page.h.artnum);
  653.     if (Page.h.artnum >= L_allow)
  654.         fw_flush();
  655. }
  656.  
  657. fw_done()
  658. {
  659.     if (Curgp != NULL && Page.h.artnum > 0)
  660.     {
  661.         /* correct if server was lying at fw_group() */
  662.         Curgp->flags |= FLG_SEARCH;
  663.         fw_flush();
  664.     }
  665. }
  666.  
  667. static
  668. fw_flush()
  669. {
  670.     ++(Curgp->pages);
  671.     ++Lrec;
  672.     Curgp->flags |= FLG_PAGE;
  673.     do_write();
  674.     Page.h.artnum = 0;
  675. }
  676.  
  677. find_page (n)
  678. int n;
  679. {
  680.     long off,lseek();
  681.     int i,last;
  682.     Cur_page = n;
  683.     off = Pgsize;
  684.     off *= (long) n;
  685.     lseek (Tdes, off, 0);
  686.     if (read(Tdes, (char *) &(Page.h), sizeof(HEAD)) < sizeof(HEAD))
  687.         printex("bad temp file read");
  688.     i = Pgsize - sizeof(HEAD);
  689.     if (read(Tdes, (char *) Page.b, i) < i)
  690.         printex("bad temp file read");
  691.     last = -1;
  692.     for (i=0; i < Ncount; ++i)
  693.     {
  694.         if ((Newsorder[i])->pages > 0)
  695.         {
  696.             if ((Newsorder[i])->pnum > n)
  697.                 break;
  698.             last = i;
  699.         }
  700.     }
  701.     if (last < 0)
  702.         printex ("can't find page %d",n);
  703.     Page.h.group = Newsorder[last];
  704.     Page.h.name = (Page.h.group)->nd_name;
  705.     vns_gset(Page.h.name);
  706. }
  707.  
  708. write_page ()
  709. {
  710.     long off,lseek();
  711.     if (!Digest)
  712.     {
  713.         off = Pgsize;
  714.         off *= (long) Cur_page;
  715.         lseek (Tdes, off, 0);
  716.         do_write();
  717.     }
  718. }
  719.  
  720. static do_write()
  721. {
  722.     int num;
  723.  
  724.     if (write(Tdes, (char *) &(Page.h), sizeof(HEAD)) < sizeof(HEAD))
  725.         printex ("Bad temp file write");
  726.     num = L_allow * sizeof(BODY);
  727.     if (write(Tdes, (char *) Page.b, num) < num)
  728.         printex ("Bad temp file write");
  729. }
  730.  
  731. form_title (t,fn,fl,ff,n)
  732. char *t,*fn,*fl,*ff;
  733. int n;
  734. {
  735.     char *ptr,*index();
  736.     int i;
  737.  
  738.     if ((ptr = index(ff,'(')) != NULL && strlen(ptr) > 3)
  739.         ff = ptr;
  740.     sprintf (t,TFORMAT,fn,fl,ff);
  741.     sprintf(ff,Aformat,' ',' ',n);
  742.     i = C_allow - strlen(ff) + 1;    /* remember newline in Aformat */
  743.     t[i] = '\0';
  744.     ctl_xlt(t);
  745.     return (0);
  746. }
  747.  
  748. /* replace control characters in titles */
  749. static ctl_xlt(s)
  750. char *s;
  751. {
  752.     while (*s != '\0')
  753.     {
  754.         if (*s < ' ')
  755.             *s += 'A' - 1;
  756.         ++s;
  757.     }
  758. }
  759. SHAR_EOF
  760. fi # end of overwriting check
  761. echo shar: extracting "'digest.c'" '(5687 characters)'
  762. if test -f 'digest.c'
  763. then
  764.     echo shar: will not over-write existing file "'digest.c'"
  765. else
  766. cat << \SHAR_EOF > 'digest.c'
  767. /*
  768. ** vn news reader.
  769. **
  770. ** digest.c - digest unpacking routines
  771. **
  772. ** see copyright disclaimer / history in vn.c source file
  773. */
  774.  
  775. #include <stdio.h>
  776. #include "config.h"
  777. #include "head.h"
  778. #include "tune.h"
  779. #include "node.h"
  780. #include "page.h"
  781.  
  782. extern int Digest;
  783. extern int L_allow;
  784. extern int C_allow;
  785. extern PAGE Page;
  786.  
  787. extern FILE *vns_aopen();
  788.  
  789. static char *Ext_pool = NULL;
  790. static char *Show[3];
  791.  
  792. static char *Dhead = "Date: ";
  793. static char *Fhead = "From: ";
  794. static char *Lhead = "Lines: ";
  795. static char *Thead = "Subject: ";
  796.  
  797. #define THDLEN 9
  798. #define LHDLEN 7
  799. #define FHDLEN 6
  800. #define DHDLEN 6
  801.  
  802. digest_page (idx,skip)
  803. int idx;
  804. {
  805.     char name[24];
  806.     FILE *fp;
  807.     int i,len,hl;
  808.     char subj[RECLEN],date[RECLEN],from[RECLEN],junk[RECLEN],*str_store();
  809.     long pos;
  810.     ARTHEADER hdr;
  811.  
  812.     Digest = Page.b[idx].art_id;
  813.  
  814.     if ((fp = vns_aopen(Digest,&hdr)) == NULL)
  815.         return (-1);
  816.  
  817.     subj[0] = date[0] = from[0] = junk[0] = '\0';
  818.  
  819.     /* skip over some articles if requested to */
  820.     for (i=skip; i > 0; --i)
  821.     {
  822.         if (dig_advance(fp,from,subj,date,junk,&pos,&hl) < 0)
  823.             return (-1);
  824.     }
  825.  
  826.     for (i=0; i < L_allow &&
  827.             (len = dig_advance(fp,from,subj,date,junk,&pos,&hl)) >= 0; ++i)
  828.     {
  829.         Page.b[i].art_id = i+1+skip;
  830.         Page.b[i].art_mark = ' ';
  831.         subj [C_allow] = '\0';
  832.         from [C_allow] = '\0';
  833.         sprintf (name,"%d",len);
  834.         form_title (date,subj,name,from,100);
  835.         strcpy (Page.b[i].art_t,date);
  836.     }
  837.  
  838.     vns_aclose (fp);
  839.  
  840.     if (i == 0)
  841.         return (-1);
  842.  
  843.     Page.h.artnum = i;
  844.     return (i);
  845. }
  846.  
  847. /*
  848.     returns name of file containing "article", NULL for failure
  849. */
  850. char * digest_extract (s,art,hdr,start)
  851. char *s;
  852. int art;
  853. ARTHEADER *hdr;
  854. long *start;
  855. {
  856.     FILE *fout,*fin;
  857.     long pos;
  858.     int lines,hl;
  859.     char subj[RECLEN],date[RECLEN],from[RECLEN],bufr[RECLEN];
  860.     char extra[RECLEN];
  861.     char *index();
  862.     long ftell();
  863.     char *str_tpool(), *str_tstore();
  864.  
  865.     if (Ext_pool != NULL)
  866.         str_tfree(Ext_pool);
  867.     Ext_pool = str_tpool(3);
  868.  
  869.     if ((fin = vns_aopen(Digest,hdr)) == NULL)
  870.         return (NULL);
  871.  
  872.     for ( ; art > 0; --art)
  873.     {
  874.         from[0] = subj[0] = date[0] = '\0';
  875.         if ((lines = dig_advance(fin,from,subj,date,extra,&pos,&hl)) < 0)
  876.         {
  877.             vns_aclose(fin);
  878.             return (NULL);
  879.         }
  880.     }
  881.  
  882.     tmpnam(s);
  883.  
  884.     if ((fout = fopen(s,"w")) == NULL)
  885.     {
  886.         vns_aclose(fin);
  887.         unlink (s);
  888.         return (NULL);
  889.     }
  890.  
  891.     fseek(fin,0L,0);
  892.  
  893.     hdr->show_num = 0;
  894.     hdr->show = Show;
  895.     hdr->lines = lines;
  896.     hdr->hlines = hl;
  897.     if (subj[0] != '\0')
  898.     {
  899.         sprintf (bufr,"%s%s",Thead,subj);
  900.         Show[hdr->show_num] = str_tstore(Ext_pool,bufr);
  901.         ++(hdr->show_num);
  902.     }
  903.     if (from[0] != '\0')
  904.     {
  905.         sprintf (bufr,"%s%s",Fhead,from);
  906.         Show[hdr->show_num] = str_tstore(Ext_pool,bufr);
  907.         ++(hdr->show_num);
  908.     }
  909.     if (date[0] != '\0')
  910.     {
  911.         sprintf (bufr,"%s%s",Dhead,date);
  912.         Show[hdr->show_num] = str_tstore(Ext_pool,bufr);
  913.         ++(hdr->show_num);
  914.     }
  915.  
  916.     while (fgets(bufr,RECLEN-1,fin) != NULL && bufr[0] != '\n')
  917.     {
  918.         if (strncmp(bufr,Fhead,FHDLEN) == 0)
  919.         {
  920.             fprintf (fout,"%s%s\n",Fhead,from);
  921.             continue;
  922.         }
  923.         if (strncmp(bufr,Thead,THDLEN) == 0)
  924.         {
  925.             fprintf (fout,"%s%s\n",Thead,subj);
  926.             continue;
  927.         }
  928.         if (strncmp(bufr,Dhead,DHDLEN) == 0)
  929.         {
  930.             fprintf (fout,"%s%s\n",Dhead,date);
  931.             continue;
  932.         }
  933.         /* defer line count header - it comes last */
  934.         if (strncmp(bufr,Lhead,LHDLEN) == 0)
  935.             continue;
  936.         fprintf (fout,"%s",bufr);
  937.     }
  938.  
  939.     /* toss in extra header lines, line count header, extra newline */
  940.     fprintf (fout,"%s%s%d\n\n",extra,Lhead,lines);
  941.     *start = ftell(fout);
  942.  
  943.     fseek (fin,pos,0);
  944.  
  945.     while (fgets(bufr,RECLEN-1,fin) != NULL && strncmp(bufr,"--------",8) != 0)
  946.         fprintf(fout,"%s",bufr);
  947.  
  948.     vns_aclose (fin);
  949.     fclose (fout);
  950.     return (s);
  951. }
  952.  
  953. dig_list (s)
  954. char *s;
  955. {
  956.     char *ptr,*out,*new,ns[L_tmpnam],tmp[RECLEN],*strtok();
  957.     ARTHEADER hdr;
  958.     long pos;
  959.     int i;
  960.  
  961.     prinfo ("Extracting articles .....");
  962.     strcpy (tmp,s);
  963.     out = s;
  964.  
  965.     for (ptr = strtok(tmp," "); ptr != NULL; ptr = strtok(NULL," "))
  966.     {
  967.         i = atoi(ptr);
  968.         if ((new = digest_extract(ns,i,&hdr,&pos)) != NULL)
  969.         {
  970.             sprintf (out,"%s ",new);
  971.             out += strlen(new) + 1;
  972.         }
  973.     }
  974.  
  975.     *out = '\0';
  976.  
  977.     if (*s == '\0')
  978.         strcpy (s,"NULLDIGEST");
  979. }
  980.  
  981. dig_ulist (s)
  982. char *s;
  983. {
  984.     char *strtok();
  985.     for (s = strtok(s," "); s != NULL; s = strtok(NULL," "))
  986.         unlink (s);
  987. }
  988.  
  989. /*
  990.     returns # lines in article, -1 for failure
  991.     scans past article, returns position of start.
  992.     also returns "extra" header lines encountered, WITH newlines.
  993.     and counts total header lines.
  994. */
  995. static dig_advance (fp,from,subj,date,extra,pos,hcount)
  996. FILE *fp;
  997. char *from,*subj,*date,*extra;
  998. long *pos;
  999. int *hcount;
  1000. {
  1001.     char buf[RECLEN];
  1002.     char *ptr, *index();
  1003.     int len,state,lcount;
  1004.  
  1005.     *hcount = lcount = state = 0;
  1006.     *extra = '\0';
  1007.  
  1008.     while (fgets(buf,RECLEN-1,fp) != NULL)
  1009.     {
  1010.         buf[(len = strlen(buf) - 1)] = '\0';
  1011.         for (--len ; len >= 0 && buf[len] == ' ' || buf[len] == '\t'; --len)
  1012.             buf[len] = '\0';
  1013.         ++len;
  1014.  
  1015.         switch(state)
  1016.         {
  1017.         case 0:
  1018.             /* skip blank lines before header */
  1019.             if (len == 0)
  1020.                 break;
  1021.             state = 1;    /* fall through */
  1022.         case 1:
  1023.             ++(*hcount);
  1024.             if (strncmp(buf,Fhead,FHDLEN) == 0)
  1025.             {
  1026.                 strcpy (from,buf+FHDLEN);
  1027.                 break;
  1028.             }
  1029.             if (strncmp(buf,Thead,THDLEN) == 0)
  1030.             {
  1031.                 strcpy (subj,buf+THDLEN);
  1032.                 break;
  1033.             }
  1034.             if (strncmp(buf,Dhead,DHDLEN) == 0)
  1035.             {
  1036.                 strcpy (date,buf+DHDLEN);
  1037.                 break;
  1038.             }
  1039.             /* put wierd header lines in extra */
  1040.             if ((ptr = index(buf,':')) != NULL)
  1041.             {
  1042.                 *ptr = '\0';
  1043.                 if (index(buf, ' ') == NULL)
  1044.                 {
  1045.                     *ptr = ':';
  1046.                     sprintf(extra,"%s\n",buf);
  1047.                     extra += strlen(extra);
  1048.                     break;
  1049.                 }
  1050.                 *ptr = ':';
  1051.             }
  1052.             state = 2;
  1053.             --(*hcount);
  1054.  
  1055.             /* remember the newline we lopped off */
  1056.             *pos = ftell(fp)-strlen(buf)-1;    /* fall through */
  1057.         case 2:
  1058.             ++lcount;
  1059.             if (strncmp("--------",buf,8) == 0)
  1060.             {
  1061.                 --lcount;
  1062.                 return (lcount);
  1063.             }
  1064.             break;
  1065.         }
  1066.     }
  1067.  
  1068.     return (-1);
  1069. }
  1070. SHAR_EOF
  1071. fi # end of overwriting check
  1072. echo shar: extracting "'brk.h'" '(750 characters)'
  1073. if test -f 'brk.h'
  1074. then
  1075.     echo shar: will not over-write existing file "'brk.h'"
  1076. else
  1077. cat << \SHAR_EOF > 'brk.h'
  1078. /*
  1079. ** vn news reader.
  1080. **
  1081. ** brk.h - codes for sig_set routine
  1082. **
  1083. ** see copyright disclaimer / history in vn.c source file
  1084. */
  1085.  
  1086. /*
  1087.     state flags for handling breaks / values for sig_set calls.
  1088.     BRK_IN, BRK_SESS, BRK_READ and BRK_OUT are the states.  All
  1089.     but BRK_INIT are used as calls to sig_set.  BRK_RFIN indicates
  1090.     a return from BRK_READ to BRK_SESS (no jump location passed),
  1091. */
  1092. #define BRK_INIT 0        /* initial value, indicating uncaught signals */
  1093. #define BRK_IN 1        /* in NEWSRC / article scanning phase */
  1094. #define BRK_SESS 2        /* in page interactive session */
  1095. #define BRK_READ 3        /* reading articles */
  1096. #define BRK_RFIN 4        /* finished reading, return to old mode */
  1097. #define BRK_OUT 5        /* NEWSRC updating phase */
  1098.  
  1099. #define BRK_PR "really quit ? "
  1100. SHAR_EOF
  1101. fi # end of overwriting check
  1102. echo shar: extracting "'head.h'" '(2530 characters)'
  1103. if test -f 'head.h'
  1104. then
  1105.     echo shar: will not over-write existing file "'head.h'"
  1106. else
  1107. cat << \SHAR_EOF > 'head.h'
  1108. /*
  1109. ** vn news reader.
  1110. **
  1111. ** head.h - header line structure
  1112. **
  1113. ** see copyright disclaimer / history in vn.c source file
  1114. */
  1115.  
  1116. /*
  1117. ** How this thing works:
  1118. **
  1119. ** this structure is filled in by vns_aopen when opening an article.
  1120. ** lines & hlines items will be used in providing percentage read prompts
  1121. **
  1122. ** show_num & show are the article information lines presented for the user
  1123. ** when the "show headers" flag is turned off.
  1124. **
  1125. ** from and artid are used for mail salutations, etc.
  1126. **
  1127. ** The items used for mail replies, FOLLOWING the call to the mail massager
  1128. ** if there is one, are mailcmd, mail_num, and mail.  These are the items
  1129. ** the massager should fill in.  If no massager exists, vns_aopen will
  1130. ** fill these in directly.  If mail_err is non-null, the user won't be
  1131. ** able to mail a reply to the article, and the item should be an error
  1132. ** message explaining why.  If there is a mailer function, the mailcmd
  1133. ** item is not used.
  1134. **
  1135. ** The priv and priv_num items are for sole use of the server layer in
  1136. ** the mail massager, mailer and poster functions.
  1137. **
  1138. ** The postcmd, post_num, and post arguments are used in treatment of
  1139. ** followups.  If post_err is non-null, followup won't be allowed, for
  1140. ** the reason described therein.  If there is a poster function, the
  1141. ** postcmd item isn't used.
  1142. **
  1143. ** The header lines for inclusion in mail / followup files will open
  1144. ** the file, and will be followed by one blank line.  The lines are literal -
  1145. ** all appropriate headers should be prepended, etc.
  1146. **
  1147. ** postcmd / mailcmd are used as format strings which are assumed to have a
  1148. ** single %s in them some place for the placement of the users editted file.
  1149. ** The result will be spawned as a command.
  1150. */
  1151.  
  1152. typedef struct
  1153. {
  1154.     int lines;        /* number of lines in article */
  1155.     int hlines;        /* number of header lines in article */
  1156.     char *from;        /* authors name */
  1157.     char *artid;        /* article id */
  1158.     int show_num;        /* number of extra lines for reader display */
  1159.     char **show;        /* extra header lines */
  1160.     int priv_num;        /* number of private arguments */
  1161.     char **priv;        /* private server arguments */
  1162.     char *mail_err;        /* mail reply error message */
  1163.     char *mailcmd;        /* command line for mailer */
  1164.     int mail_num;        /* number of header lines in mail reply file */
  1165.     char **mail;        /* mail reply header lines */
  1166.     char *post_err;        /* follow-up posting error message */
  1167.     char *postcmd;        /* command line for followup poster */
  1168.     int post_num;        /* number of header lines for followup file */
  1169.     char **post;        /* followup header lines */
  1170. } ARTHEADER;
  1171. SHAR_EOF
  1172. fi # end of overwriting check
  1173. echo shar: extracting "'node.h'" '(1580 characters)'
  1174. if test -f 'node.h'
  1175. then
  1176.     echo shar: will not over-write existing file "'node.h'"
  1177. else
  1178. cat << \SHAR_EOF > 'node.h'
  1179. /*
  1180. ** vn news reader.
  1181. **
  1182. ** node.h - NODE structure
  1183. **
  1184. ** see copyright disclaimer / history in vn.c source file
  1185. */
  1186.  
  1187. /* newsgroup status flags */
  1188. #define FLG_SUB 1    /* user subscribed to newsgroup */
  1189. #define FLG_PAGE 2    /* a page exists to display */
  1190. #define FLG_NEW 4    /* new newsgroup */
  1191. #define FLG_ECHG 8    /* edit change by user */
  1192. #define FLG_SEARCH 16    /* newsgroup was searched */
  1193. #define FLG_ACC 32    /* newsgroup had articles accessed */
  1194. #define FLG_STAT 64    /* stat's written */
  1195.  
  1196. /*
  1197.     newsgroup information (hash table node)
  1198.  
  1199.     items unaccessed by server interface:
  1200.         next - hashtable link
  1201.         pnum - page number
  1202.         pages - number of pages for news display
  1203.         pgshwn - pages shown mask
  1204.         pgrd - article number on highest conecutively shown page
  1205.         order - order of appearance in Newsorder array.
  1206.         orgrd - original articles read number
  1207.  
  1208.     may be read following hashfind by server interface, but not written:
  1209.         nd_name - name of newsgroup (key to reach node by)
  1210.             this will be a permanent copy of the name.
  1211.         highnum - high article number in group
  1212.         lownum - low article number in group
  1213.  
  1214.     legal for vns_write to read, but not written by server interface:
  1215.         flags - bit mask of FLG_xxxx flags.
  1216.         rdnum - articles read.
  1217.  
  1218.     unused by vn user interface, intended for use by server interface:
  1219.         state - state variable.  initted 0.
  1220.         data - arbitrary data pointer.  initted NULL.
  1221. */
  1222. typedef struct _node
  1223. {
  1224.     struct _node *next;
  1225.     char *nd_name;
  1226.     int highnum, lownum;
  1227.     int pnum, pages, rdnum, orgrd, pgrd;
  1228.     unsigned long pgshwn;
  1229.     unsigned flags;
  1230.     int order;
  1231.     unsigned state;
  1232.     char *data;
  1233. } NODE;
  1234. SHAR_EOF
  1235. fi # end of overwriting check
  1236. echo shar: extracting "'page.h'" '(1152 characters)'
  1237. if test -f 'page.h'
  1238. then
  1239.     echo shar: will not over-write existing file "'page.h'"
  1240. else
  1241. cat << \SHAR_EOF > 'page.h'
  1242. /*
  1243. ** vn news reader.
  1244. **
  1245. ** page.h - display page structure
  1246. **
  1247. ** see copyright disclaimer / history in vn.c source file
  1248. */
  1249.  
  1250. /*
  1251.     page display format and dependent parameters
  1252. */
  1253. #define HFORMAT "\n%s (page %d of %d):"
  1254. #define DHFORMAT "\n%s (DIGEST EXTRACTION):"
  1255. #define TFORMAT "%s ~ %s %s"
  1256. #define AFORMAT "\n%c%c%d) "    /* begin with newline - see show routine */
  1257. #define AFLEN 5        /* min. char. in article id - depends on AFORMAT */
  1258. #define CFORMAT "page %d of %d (%d shown), newsgroup %d of %d"
  1259. #define RECBIAS 2    /* lines before articles - depends on HFORMAT */
  1260. #define WRCOL 1        /* column of written mark.  depends on AFORMAT */
  1261. #define INFOLINE 0    /* HFORMAT TFORMAT leaves for use */
  1262. #define REQLINES 7    /* required terminal lines for display, incl. help */
  1263.  
  1264. /*
  1265.     newsgroup information for page display
  1266.     name - of group
  1267.     group - pointer to table entry
  1268.     artnum - number of articles
  1269. */
  1270. typedef struct
  1271. {
  1272.     char *name;
  1273.     NODE *group;
  1274.     int artnum;
  1275. } HEAD;
  1276.  
  1277. /*
  1278.     article information - id (spool) number, title string, mark, written.
  1279. */
  1280. typedef struct
  1281. {
  1282.     int art_id;
  1283.     char art_mark;
  1284.     char art_t[MAX_C-AFLEN];
  1285. } BODY;
  1286.  
  1287. typedef struct
  1288. {
  1289.     HEAD h;
  1290.     BODY *b;
  1291. } PAGE;
  1292. SHAR_EOF
  1293. fi # end of overwriting check
  1294. echo shar: extracting "'reader.h'" '(1537 characters)'
  1295. if test -f 'reader.h'
  1296. then
  1297.     echo shar: will not over-write existing file "'reader.h'"
  1298. else
  1299. cat << \SHAR_EOF > 'reader.h'
  1300. /*
  1301. ** vn news reader.
  1302. **
  1303. ** reader.h - article reading interface definitions
  1304. **
  1305. ** see copyright disclaimer / history in vn.c source file
  1306. */
  1307.  
  1308. #define PAGE_MID ":more (%2d%%):"
  1309. #define PAGE_NEXT ":next article:"
  1310. #define PAGE_END ":end:"
  1311. #define PAGE_NO ":?:"
  1312. #define PPR_MAX 18    /* maximum length of PAGE prompts */
  1313.  
  1314. /*
  1315.     reading commands: no control chars, add help message to helppg
  1316.     SAVE, PRINT, HEADTOG and SETROT are also recognized
  1317. */
  1318. #define HPG_HEAD "toggle header print flag"
  1319. #define HPG_ROT "toggle rotation"
  1320. #define HPG_SAVE "save article in a file"
  1321. #define HPG_PRINT "print article"
  1322. #define PG_NEXT 'n'
  1323. #define HPG_NEXT "next article, if any"
  1324. #define PG_QUIT 'q'
  1325. #define HPG_QUIT "quit reading articles, if any more to read"
  1326. #define PG_FLIP 'Q'
  1327. #define HPG_FLIP "quit reading, and turn to next page of articles"
  1328. #define PG_FOLLOW 'f'
  1329. #define HPG_FOLLOW "post followup to article"
  1330. #define PG_REPLY 'm'
  1331. #define HPG_REPLY "send mail to author of article"
  1332. #define PG_HELP '?'
  1333. #define HPG_HELP "see this help menu"
  1334. #define PG_REWIND 'r'
  1335. #define HPG_REWIND "rewind article to beginning"
  1336. #define PG_WIND 'e'
  1337. #define HPG_WIND "seek to end of article (to next/end prompt)"
  1338. #define PG_STEP '\n'
  1339. #define HPG_STEP "next line"
  1340. #define PG_SEARCH '/'
  1341. #define HPG_SEARCH "search for regular expression in remainder of article"
  1342. #define SEARCHFORM "search pattern (%s) ? "
  1343. #define HPG_DEF "\n anything else to continue normal reading"
  1344. #define HPG_EDEF "\n anything else to try reading next article, if any"
  1345.  
  1346. #define ANFORM ":%s - %c for help:\n"
  1347. SHAR_EOF
  1348. fi # end of overwriting check
  1349. echo shar: extracting "'server.h'" '(151 characters)'
  1350. if test -f 'server.h'
  1351. then
  1352.     echo shar: will not over-write existing file "'server.h'"
  1353. else
  1354. cat << \SHAR_EOF > 'server.h'
  1355.  
  1356. /*
  1357. **    header files shared between vn and vns_xxxx server interface routines
  1358. */
  1359. #include "tune.h"
  1360. #include "tty.h"
  1361. #include "node.h"
  1362. #include "head.h"
  1363. SHAR_EOF
  1364. fi # end of overwriting check
  1365. echo shar: extracting "'tty.h'" '(404 characters)'
  1366. if test -f 'tty.h'
  1367. then
  1368.     echo shar: will not over-write existing file "'tty.h'"
  1369. else
  1370. cat << \SHAR_EOF > 'tty.h'
  1371. /*
  1372. ** vn news reader.
  1373. **
  1374. ** tty.h - codes for tty_set and term_set
  1375. **
  1376. ** see copyright disclaimer / history in vn.c source file
  1377. */
  1378.  
  1379. #define MOVE 100
  1380. #define ERASE 101
  1381. #define START 102
  1382. #define STOP 103
  1383. #define RUBSEQ 104
  1384. #define ZAP 105
  1385. #define ONREVERSE 106
  1386. #define OFFREVERSE 107
  1387. #define RESTART 108
  1388.  
  1389. #define RAWMODE 200
  1390. #define COOKED 201
  1391. #define SAVEMODE 202
  1392. #define RESTORE 203
  1393. #define BACKSTOP 204
  1394. SHAR_EOF
  1395. fi # end of overwriting check
  1396. echo shar: extracting "'tune.h'" '(2198 characters)'
  1397. if test -f 'tune.h'
  1398. then
  1399.     echo shar: will not over-write existing file "'tune.h'"
  1400. else
  1401. cat << \SHAR_EOF > 'tune.h'
  1402. /*
  1403. ** vn news reader.
  1404. **
  1405. ** tune.h - system tuning parameters
  1406. **
  1407. ** see copyright disclaimer / history in vn.c source file
  1408. */
  1409.  
  1410. /*
  1411. **    buffer size needed for tmpnam()
  1412. */
  1413. #ifndef L_tmpnam
  1414. #define L_tmpnam 48
  1415. #endif
  1416.  
  1417. /*
  1418. ** hash table size.  linked list type of table which can expand to
  1419. ** arbitrary density, including densities > 100%.  Number of entries
  1420. ** will be number of newsgroups in active list.  This should be a prime
  1421. ** number ("long division" of string modulo table size hash function).
  1422. */
  1423. #define HASHSIZE 809
  1424.  
  1425. /*
  1426. **    maximum number of columns on terminal.  If made smaller, there
  1427. **    will be a savings in the size of the temporary file used
  1428. **    for holding displays, at the penalty of not being able to use
  1429. **    the entire screen width on terminals actually possessing more
  1430. **    columns than this.  A block roughly on the order of this value
  1431. **    times the number of lines the terminal has is maintained per page in
  1432. **    the temp file, and read / written as displays are interacted
  1433. **    with.  MIN_C put here because MAX_C > MIN_C.  MIN_C is the minumum
  1434. **    number of columns for which a "reasonable" display can be produced.
  1435. **    before making it smaller, look at all uses of C_allow and variable
  1436. **    to see that a setting that small won't screw up array bounds.
  1437. */
  1438. #define MAX_C 132
  1439. #define MIN_C 36
  1440.  
  1441. /*
  1442. **    large size for general purpose local buffers.  only used in automatic
  1443. **    variable declarations.  Used with fgets for buffer size when reading
  1444. **    file records, to hold pathnames, commands, etc.  Reduce if you blow
  1445. **    out stack storage.  If reduced too far, may eventually show up
  1446. **    as syntax errors on interacting with vns_ routines, or command line
  1447. **    botches.
  1448. */
  1449. #define RECLEN 1200
  1450.  
  1451. /* block sizes for allocation routines */
  1452. #define STRBLKSIZE 1800    /* string storage allocation block */
  1453. #define NDBLKSIZE 50    /* NODE structures to allocate at a time */
  1454.  
  1455. /*
  1456. ** maximum number of articles to allow for processing in a single user
  1457. ** list.  Used only to declare an array of pointers on the stack, so it
  1458. ** can be fair sized without much problem.  In practicality, there is
  1459. ** no use for it being larger than the greatest line length available
  1460. ** on the CRT's being used.
  1461. */
  1462. #define MAXARTLIST 200
  1463. SHAR_EOF
  1464. fi # end of overwriting check
  1465. echo shar: extracting "'vn.h'" '(1654 characters)'
  1466. if test -f 'vn.h'
  1467. then
  1468.     echo shar: will not over-write existing file "'vn.h'"
  1469. else
  1470. cat << \SHAR_EOF > 'vn.h'
  1471. /*
  1472. ** vn news reader.
  1473. **
  1474. ** vn.h - general parameters
  1475. **
  1476. ** see copyright disclaimer / history in vn.c source file
  1477. */
  1478.  
  1479. #define TRUE 1
  1480. #define FALSE 0
  1481.  
  1482. #define ED_MARK '>'
  1483. #define ART_MARK '*'
  1484. #define ART_WRITTEN '_'
  1485. #define ART_UNWRITTEN ' '
  1486.  
  1487.  
  1488. #define ANFORM ":%s - %c for help:\n"
  1489. #define ANFLINES 1
  1490. #define UDKFORM "undefined key - %c for help"
  1491. #define HELPFORM "%c for help"
  1492.  
  1493. /*
  1494.     command characters - don't use numerics or <ESC>
  1495.     ALTSAVE is a hack to avoid having to use ctl-s - XON/XOFF.
  1496.     Wanted to preserve "s" pneumonic and lower / control /cap
  1497.     convention.
  1498. */
  1499. #define DIGEST 'd'
  1500. #define UP 'k'
  1501. #define DOWN 'j'
  1502. #define FORWARD '\012'
  1503. #define BACK '\010'
  1504. #define READ 'r'
  1505. #define ALTREAD ' '
  1506. #define READALL 'R'
  1507. #define READSTRING '\022'
  1508. #define SAVE 's'
  1509. #define SAVEALL 'S'
  1510. #define SAVESTRING '\023'
  1511. #define ALTSAVE '\024'
  1512. #define PRINT 'p'
  1513. #define PRINTALL 'P'
  1514. #define PRINTSTRING '\020'
  1515. #define MARK 'x'
  1516. #define UNMARK 'X'
  1517. #define REDRAW '\014'
  1518. #define QUIT 'q'
  1519. #define SSTAT '#'
  1520. #define GRPLIST '%'
  1521. #define ORGGRP 'o'
  1522. #define ORGSTAT 'O'
  1523. #define UPDATE 'w'
  1524. #define UNSUBSCRIBE 'u'
  1525. #define UPALL 'W'
  1526. #define UPSEEN '\027'
  1527. #define UNESC '!'
  1528. #define NEWGROUP 'n'
  1529. #define HEADTOG 'h'
  1530. #define SETROT 'z'
  1531. #define HELP '?'
  1532. #define TOPMOVE 'H'
  1533. #define BOTMOVE 'L'
  1534. #define ALTBOTTOM 'G'
  1535. #define MIDMOVE 'M'
  1536. #define PRTVERSION '"'
  1537. #define HELP_HEAD "[...] = effect of optional number preceding command\n\
  1538. pipes are specified by filenames beginning with |\n\
  1539. articles specified as a list of numbers, title search string, or\n\
  1540.     * to specify marked articles.  ! may be used to negate any\n"
  1541.  
  1542. #define HHLINES 5    /* lines (CRs + 1) contained in HELP_HEAD */
  1543. SHAR_EOF
  1544. fi # end of overwriting check
  1545. #    End of shell archive
  1546. exit 0
  1547.